import React, { Component } from "react";

export default class Parent extends Component {
  render() {
    const person = {
      name:"wukong",
      age:18,
      sex:"male"
    }
    return (
      <>
        <h2>Parent</h2>
        <A {...person}/>
      </>
    );
  }
}

class A extends Component {
  constructor(props){
    super(props)
    console.log(props);
  }
  render() {
    const { name, age, sex } = this.props;
    return (
      <>
        <h3>A Child</h3>
        <div>{name}</div>
        <div>{age}</div>
        <div>{sex}</div>
      </>
    );
  }
}

